package com.example.blog.result;

import lombok.Data;

@Data
public class Result<T> {
    private int code;
    private String msg;
    private T data;
    public  static <T>Result<T> success(T data) {
        Result result = new Result();
        result.setCode(ResultCodeEnum.SUCCESS.getCode());
        result.setData(data);
        return result;
    }
    public static <T>Result<T> fail(String msg) {
        Result result = new Result();
        result.setCode(ResultCodeEnum.FAIL.getCode());
        result.setMsg(msg);
        return result;
    }
}
